package com.ruoyi.student_club.vo.app;

import lombok.Data;

/**
 * @Author lin
 * @Date 2022/2/14 16:17
 */
@Data
public class ClubActivityVo {

    private Long id;

    private String avatar;

    private String title;

    private String content;

    public void setAvatar(String avatar) {
        if (avatar != null && avatar.contains("upload")){
            this.avatar = avatar.substring(avatar.indexOf("upload")-1);
        }
    }

    public void setContent(String content){
        String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
        if (content != null){
           this.content = content
                   .replaceAll(regEx_style,"")
                   .replaceAll("<[a-zA-Z]+[1-9]?[^><]*>", "")
                   .replaceAll("</[a-zA-Z]+[1-9]?>", "")
                   .replaceAll("<!--[\\w\\W\\r\\n]*?-->","");
        }
    }

}
